export default app => {
  const { STRING, INTEGER, DATE } = app.Sequelize;

  const applicationOrganization = app.model.define('application_organization', {
    id: { type: INTEGER, primaryKey: true, autoIncrement: true },
    uuid: { type: STRING(36), unique: true },
    name: STRING(50), // 申请公司名称
    createdAt: DATE,
    updatedAt: DATE,
  });
  applicationOrganization.associate = () => {
    app.model.ApplicationOrganization.belongsToMany(app.model.Patent, {
      through: app.model.MergePatentApplicationOrganization,
      foreignKey: 'application_organization_id',
      otherKey: 'patent_id',
    });
  };
  return applicationOrganization;
};
